using System;
using System.Collections;
using System.Data;

namespace SpringWaterDataAccess
{
	/// <summary>
	/// Summary description for BookShelf.
	/// </summary>
	public class BookShelf
	{
		#region PrivateMembers
		UserObject user;
		#endregion

		#region Constructors
		public BookShelf(UserObject user)
		{
			this.user = user;
		}
		#endregion

		#region PublicMethods Done
		public DataSet GetWords()
		{
			try
			{
				SQLAccess sql = new SQLAccess();
				DataSet ds = sql.RetrieveAllWords(user.Email);
				if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count==0)
					return null;
				return ds;
			}
			catch(Exception e)
			{
				return null;
			}		
		}

		public bool RemoveWord(string wordIDs)
		{
			try
			{
				SQLAccess sql = new SQLAccess();
				sql.DeleteWord(user.Email, wordIDs);
				return true;
			}
			catch(Exception e)
			{
				return false;
			}		
		}

		public void AddWord(int wordID)
		{
			SQLAccess sql = new SQLAccess();
			sql.AddOneWord(user.Email, wordID);
		}
		#endregion
	}
}
